<template>
  <xy-page>
    <el-form label-width="140px" class="theform">
      <div class="titles">观看条件</div>
      <el-form-item>
        <el-radio-group v-model="demandRadio" @change="radioChange">
          <el-radio label="none">无限制</el-radio>
          <el-radio label="code">验证码</el-radio>
          <el-radio label="external">第三方鉴权</el-radio>
        </el-radio-group>
      </el-form-item>
      <div v-show="demandRadio=='code'">
        <el-form-item label="验证码：">
          <el-col :span="20">
            <el-input v-model="identifyCode" clearable maxlength="8"></el-input>
          </el-col>
        </el-form-item>
        <el-form-item label="欢迎标题：">
          <el-col :span="20">
            <el-input v-model="welcomeTitle" clearable maxlength="20"></el-input>
          </el-col>
        </el-form-item>
      </div>
      <div v-show="demandRadio=='external'">
        <el-form-item label="SecretKey：">
          <el-col :span="20">
            <el-input v-model="SecretKey" disabled></el-input>
          </el-col>
          <el-col :span="4">
            <el-button class="changebtn" @click="changeKey">换一个</el-button>
          </el-col>
        </el-form-item>
        <el-form-item label="自定义URL：">
          <el-col :span="20">
            <el-input v-model="selfDefiURL" clearable placeholder="自定义URL" maxlength="60"></el-input>
          </el-col>
        </el-form-item>
        <el-form-item label="跳转地址：">
          <el-col :span="20">
            <el-input v-model="externalRedirectUri" clearable placeholder="跳转地址" maxlength="60"></el-input>
          </el-col>
        </el-form-item>
      </div>
      <div class="titles">应用图片</div>
      <el-form-item label="当前直播图标：">
        <div>
          <el-col :span="6">
            <div class="photoContain">
              <img v-if="guaidPic" :src="guaidPic">
              <img v-else src="/static/images/default-polyv-logo.png">
            </div>
          </el-col>
          <el-col :span="18">
            <p>为了保证显示效果，请上传140×140大小的图片，支持jpg、jpeg、png格式，文件大小不超过2M</p>
          </el-col>
        </div>
        <div>
          <xy-upload @uploadImage="getGuaidPic" :imgSize="4" :uploadAppId="devAppId" accept="image/jpeg,image/png" checkSuffix="jpg,jpeg,png">
            <el-button type="primary">上传图标</el-button>
          </xy-upload>
        </div>
      </el-form-item>
      <div class="titles">PC观看页跑马灯</div>
      <el-form-item label="防录屏跑马灯：" class="switchBtn">
        <el-switch v-model="isLamp"></el-switch>
        <el-button @click="lookVideo" v-show="(lampType=='fixed' && isLamp)||(lampType=='nickname' && isLamp)" type="primary">预览</el-button>
      </el-form-item>
      <div v-show="isLamp">
        <el-form-item label="跑马灯类型：">
          <el-radio-group v-model="lampType">
            <el-radio label="fixed">固定值</el-radio>
            <el-radio label="nickname">登录用户名</el-radio>
            <el-radio label="diyurl">URL自定义设置</el-radio>
          </el-radio-group>
        </el-form-item>
        <div v-show="lampType=='fixed'">
          <el-form-item label="设置固定值：">
            <el-input v-model="fixVal" clearable maxlength="20" placeholder="最长20个字符"></el-input>
          </el-form-item>
          <el-form-item label="字体大小：">
            <el-col :span="10">
              <el-input v-model="fontSize" oninput="this.value=this.value.replace(/[^0-9]/g,'')" @change="changeSize" clearable maxlength="4" placeholder="最长4位数"></el-input>
            </el-col>
            <span class="colorSet">&nbsp;&nbsp;&nbsp;字体颜色：</span><el-color-picker v-model="fontColor" style="padding-left:100px;"></el-color-picker>
          </el-form-item>
          <el-form-item label="透明度：">
            <el-slider v-model="slideVal"></el-slider>
          </el-form-item>
          <el-form-item label="自定义缩放：" class="switchBtn">
            <el-switch v-model="isScale"></el-switch>
          </el-form-item>
        </div>
        <div v-show="lampType=='nickname'">
          <el-form-item label="字体大小：">
            <el-col :span="10">
              <el-input v-model="fontSize" clearable oninput="this.value=this.value.replace(/[^0-9]/g,'')" @change="changeSize" maxlength="4" placeholder="最长4位数"></el-input>
            </el-col>
            <span class="colorSet">&nbsp;&nbsp;&nbsp;字体颜色：</span><el-color-picker v-model="fontColor" style="padding-left:100px;"></el-color-picker>
          </el-form-item>
          <el-form-item label="透明度：">
            <el-slider v-model="slideVal"></el-slider>
          </el-form-item>
          <el-form-item label="自定义缩放：" class="switchBtn">
            <el-switch v-model="isScale"></el-switch>
          </el-form-item>
        </div>
        <div v-show="lampType=='diyurl'">
          <el-form-item label="设置自定义URL：" class="lampUrl">
            <el-col :span="20">
              <el-input v-model="qturl" maxlength="60">
                <template slot="prepend">
                  <el-select v-model="setUrl">
                    <el-option v-for="item in httpOptions" :key="item.value" :label="item.label" :value="item.value"></el-option>
                  </el-select>
                </template>
              </el-input>
            </el-col>
          </el-form-item>
          <el-form-item label="自定义缩放：" class="switchBtn">
            <el-switch v-model="isScale"></el-switch>
          </el-form-item>
        </div>
      </div>
      <div class="titles">聊天室严禁词</div>
      <span class="attachTitle">添加聊天严禁词后，用户发送聊天信息包括严禁词将无法成功发送</span>
      <el-form-item label="严禁词列表:">
        <el-col :span="20">
          <el-input type="textarea" class="ft10" :rows="4" disabled resize="none" :value="(!form.forbidList.length&&form.forbLoading)?forbLoading:(!form.forbidList.length?'暂无数据':form.forbidList)"></el-input>
        </el-col>
        <el-button type="text" class="forbidSet" @click="setForbWords">设置</el-button>
      </el-form-item>
      <div class="titles">播放网站限制</div>
      <el-form-item>
        <div class="mgl10 memo">设置后，设置播放黑白名单，白色单允许播放，黑名单无法播放</div>
        <div class="memo">(只需要填写域名，多个域名之间用英文逗号分隔，如：domain.com,domain2.net,sub.domain3.net)</div>
      </el-form-item>
      <el-form-item label="播放网站白名单:">
        <el-col :span="20">
          <el-input type="textarea" class="ft10" :rows="4" v-model="form.whiteText" resize="none"></el-input>
        </el-col>
      </el-form-item>
      <el-form-item label="播放网站黑名单:">
        <el-col :span="20">
          <el-input type="textarea" class="ft10" :rows="4" v-model="form.blackText" resize="none"></el-input>
        </el-col>
      </el-form-item>
      <el-form-item>
        <el-button @click="save" type="primary">保存</el-button>
      </el-form-item>
    </el-form>
    <el-dialog title="预览" :visible.sync="dialogPlay" v-if="dialogPlay" width="700px">
        <div class="mgt20" >
          <video :src="videoSrc" controls  width="100%" height="100%" style="border:1px solid #ccc" object-fit="fill" controlsList="nodownload" ref="video"></video>
          <marquee style="position: absolute;display: inline-block;width: 660px;overflow: hidden;top: 215px;color: #000; text-shadow:0px 1px 3px #fff;font-size: 30px;opacity:1" align=# ref="marquee">{{conText}}</marquee>
        </div>
        <span slot="footer" class="dialog-footer">
          <div style="text-align:center;margin-top:20px;padding-bottom:20px;">
            <el-button type="primary" @click="dialogPlay = false">关闭预览</el-button>
          </div>
        </span>
    </el-dialog>
      <el-dialog title="聊天严禁词设置" :visible.sync="isForbidDia" :before-close="beforeClose" class="forbDia">
        <el-input placeholder="搜索严禁词" class="forbidInput" v-model="searchWord" clearable @change="filForbWords">
          <i slot="prefix" class="el-input__icon el-icon-search"></i>
        </el-input>
        <el-button type="text" class="forbAddBtn">
          <a href="/static/Strictlyprohibit.xls" download="模板" style="text-decoration:none;">下载模板</a>
        </el-button>
        <el-upload action="/admin/instance/ccb/polyv/channel/badword/channelBadwordAddByExcel.do" :data="dataBody"
          :show-file-list="false"
          :headers="sessionKeyBody" class="forbAddBtn"
          :on-success="successUploadFile"
          :on-error="errorUploadFile">
          <el-button>批量添加</el-button>
        </el-upload>
        <el-button type="primary" class="forbAddBtn" @click="addForbWord">添加</el-button>
        <div class="forbTable">
          <xy-table :tableData="forbTableData" :loading="forbTableData.isLoading" :noEmpty="forbTableData.list.length==0?false:true">
            <el-table-column label="聊天室禁词" align="center" min-width="120">
              <template slot-scope="scope">
                <span v-show="scope.row.isSaved">{{scope.row.word}}</span>
                <el-input placeholder="限20个字符" v-show="!scope.row.isSaved" v-model="scope.row.word" class="rowInput" maxlength="20" clearable>{{scope.row.word}}</el-input>
              </template>
            </el-table-column>
            <el-table-column label="操作" align="center">
              <template slot-scope="scope">
                <div v-show="!scope.row.isSaved">
                  <el-button type="text" @click="saveRow(scope.row)" :loading="scope.row.isSaving">保存</el-button>
                  <el-button type="text" @click="cancelAdd(scope)">取消</el-button>
                </div>
                <div v-show="scope.row.isSaved">
                  <el-button type="text" @click="delForbWord(scope.row)">删除</el-button>
                </div>
              </template>
            </el-table-column>
          </xy-table>
        </div>
      </el-dialog>
  </xy-page>
</template>

<script>
export default {
  data() {
    return {
      forbLoading:'加载中...',
      dataBody:{},
      sessionKeyBody:{},
      tempList:[],
      searchWord:'',
      forbTableData:{
        isLoading:false,
        total:0,
        list:[]
      },
      isForbidDia:false,
      form:{
        whiteText:'',
        blackText:'',
        forbidList:'',
        forbLoading:true
      }, // 播放网站限制
      setUrl:'https://',
      qturl:'',
      httpOptions: [{
        value: 'https://',
        label: 'https://'
      },{
        value: 'http://',
        label: 'http://'
      }],
      devAppId:'',
      identifyCode:'',
      welcomeTitle:'',
      demandRadio: "none",
      SecretKey: "",
      selfDefiURL: "",
      externalRedirectUri: "",
      fixVal: "",
      fontSize: "",
      fontColor: "",
      guaidPic: "",
      updown: "向上",
      isLamp: true,
      lampType: "fixed",
      slideVal: 0,
      isScale: true,
      dialogPlay:false,
      conText:'',
      videoSrc:''
    };
  },
  methods: {
    successUploadFile(res){
      if(res.success){
        this.$message.success('添加成功')
        this.getForbWords()
      }else{
        if(res.code == 50001){
          this.$message.error(res.message)
        }else{
          this.$message.error('添加失败')
        }
      }
    },
    errorUploadFile(){
      this.$message.error('添加失败')
    },
    //严禁词搜索
    filForbWords(){
      this.forbTableData.list =  this.tempList.filter((item)=>{
        if(item.word.indexOf(this.searchWord) != -1){
          return item
        }
      })
      //暂无数据文案
      if(!this.forbTableData.list.length){
        this.forbTableData.isLoading = true
        setTimeout(()=>{this.forbTableData.isLoading = false},1)
      }
    },
    setForbWords(){
      this.isForbidDia=true
      //暂无数据文案
      if(this.forbTableData.list.length == 0 && !(!this.form.forbidList.length&&this.form.forbLoading)){
        this.forbTableData.isLoading = true
        setTimeout(()=>{this.forbTableData.isLoading = false},1)
      }
    },
    beforeClose(){
      this.forbTableData.list = this.tempList.concat()
      this.isForbidDia = false
    },
    delForbWord(row){
      this.$confirm('此操作将永久删除该严禁词, 是否继续?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.$postStream('/admin/instance/ccb/polyv/app/badword/delete.do',{
          data:{
            appId:this.devAppId,
            words:row.word
          },
          success:(res)=>{
            if(res.success){
              this.$message.success('删除成功')
              this.getForbWords()
            }else{
              if(res.code == 50001){
                this.$message.error(res.message)
              }else{
                this.$message.error('删除失败')
              }
            }
          },
          error:()=>{
            this.$message.error('删除失败')
          }
        })
      })
    },
    saveRow(row){
      if(!row.word.trim()){
        this.$message.error('禁词不能为空')
        return
      }
      row.isSaving = true
      this.$postStream('/admin/instance/ccb/polyv/common/badword/add.do',{
        data:{
          words:"['"+row.word.trim()+"']",
          appId:this.devAppId
        },
        success:(res)=>{
          if(res.success){
            this.$message.success('保存成功')
            this.getForbWords()
          }else{
            if(res.code == 50001){
              this.$message.error(res.message)
            }else{
              if(new Set(row.word).has("'")){
                this.$message.error('禁用词不能包含英文单引号')
              }else{
                this.$message.error('保存失败')
              }
            }
          }
        },
        error:()=>{
          this.$message.error('保存失败')
        },
        complete:()=>{
          row.isSaving = false
        }
      })
    },
    cancelAdd(scope){
      this.forbTableData.list.splice(scope.$index,1)
    },
    addForbWord(){
      this.forbTableData.list.unshift({word:'',disabled:false,isSaving:false})
    },
    changeSize(){
      if(this.lampType=='nickname'||this.lampType=='fixed'){
        if(this.fontSize < 1){
          this.fontSize = 1
        }else if(this.fontSize > 256){
          this.fontSize = 256
        }
      }
    },
    radioChange(){
      if(this.demandRadio=='external'&& !this.SecretKey){
        this.changeKey()
      }
    },
    lookVideo(){//观看预览
      this.dialogPlay = true
      this.videoSrc='http://plvod01.videocc.net/sl8da4jjbx/c/sl8da4jjbx0272e52e03be888a12c82c_1.mp4'
      if(this.lampType=='nickname'){
        this.conText = '显示观看者的呢称'
      }else if(this.lampType=='fixed'){
        this.conText = this.fixVal
      }else{
        this.conText = this.setUrl
      }
      this.$nextTick(()=>{
        this.$refs.marquee.style.color = this.fontColor
        this.$refs.marquee.style.fontSize = this.fontSize+'px'
        this.$refs.marquee.style.opacity = 1-this.slideVal / 100
        this.$refs.video.play()
      })
    },
    getDefSetData(){
      this.getViewCondi()
      this.getBaseImg()
      this.getHouseLamp()
      this.getRestrict()
      this.getForbWords()
    },
    getForbWords(){
      this.forbTableData.isLoading = true
      let timer = setInterval(() => {
        if(this.forbLoading == '加载中.'){
          this.forbLoading = '加载中..'
        }else if(this.forbLoading == '加载中..'){
          this.forbLoading = '加载中...'
        }else if(this.forbLoading == '加载中...'){
          this.forbLoading = '加载中.'
        }
      }, 200);
      this.$postStream('/admin/instance/ccb/polyv/app/badword/list.do',{
        data:{
          appId:this.devAppId
        },
        success:(res)=>{
          if(res.success){
            this.forbTableData.list = []
            this.form.forbidList = res.object.toString()
            this.forbTableData.total = res.object.length
            if(res.object.length){
              res.object.forEach(item=>{
                this.forbTableData.list.push({word:item,isSaved:true})
              })
            }
            this.tempList = this.forbTableData.list.concat()
          }else{
            this.$message.error('禁词获取失败')
          }
        },
        error:()=>{
          this.$message.error('禁词获取失败')
        },
        complete:()=>{
          this.forbTableData.isLoading = false
          this.form.forbLoading = false
          clearInterval(timer)
        }
      })
    },
    getViewCondi(){
      //获取观看条件
      this.$postStream('/admin/instance/ccb/polyv/pageview/condition/getViewCondition.do',{
        data:{
          appId:this.devAppId,
        },
        success:(res)=>{
          if(res.success){
            this.identifyCode = res.object.authCode
            this.welcomeTitle = res.object.qcodeTips
            this.demandRadio = res.object.authType
            this.SecretKey = res.object.externalKey
            this.selfDefiURL = res.object.externalUri
            this.externalRedirectUri = res.object.externalRedirectUri
            if(res.object.enabled=='N'){
              this.demandRadio = 'none'
            }
            
          }else{
            this.$message.error('观看条件获取失败')
          }
        },
        error:()=>{
          this.$message.error('观看条件获取失败')
        }
      })
      
    },
    getBaseImg(){
      //获取基础图片
      this.$postStream('/admin/instance/ccb/polyv/app/getBaseImage.do',{
        data:{
          appId:this.devAppId,
        },
        success:(res)=>{
          if(res.success){
            this.guaidPic = res.object.coverImg || ''
            if(res.object.coverImg == '/assets/wimages/pc_images/logo.png'){
              this.guaidPic = ''
            }
          }else{
            this.$message.error('基础图片获取失败')
          }
        },
        error:()=>{
          this.$message.error('基础图片获取失败')
        }
      })
    },
    getHouseLamp(){
      //获取跑马灯详情
      this.$postStream('/admin/instance/ccb/polyv/player/getHorseLamp.do',{
        data:{
          appId: this.devAppId,
          getActual: 'N' //Y:获取频道实际生效跑马设置，N：获取频道的跑马灯设置
        },
        success:(res)=>{
          if(res.success){
            this.isLamp = res.object.marqueeRestrict=='Y'?true:false//自定义url防录屏跑马灯开关,Y 或 N
            this.lampType = res.object.marqueeType//跑马灯类型,取值：fixed（固定值）、nickname（观众名称）、diyurl（自定义url）
            this.fontSize = res.object.marqueeFontSize//跑马灯字体大小
            this.fontColor = res.object.marqueeFontColor//跑马灯文字字体颜色
            this.slideVal = res.object.marqueeOpacity//跑马灯不透明度，范围是 0 ~ 100
            this.isScale = res.object.marqueeAutoZoomEnabled=='Y'?true:false//是否开启跑马灯自适应缩放，值为 Y 或 N
            if(res.object.marqueeType=='fixed'){
              this.fixVal = res.object.marquee//marqueeType为固定值或者自定义url 时，此字段不能为空，marqueeType=nickname 此字段为空
              this.qturl = ''
            }else if(res.object.marqueeType=='diyurl'){
              this.setUrl = res.object.marquee.split('://')[0]+'://'
              this.qturl = res.object.marquee.split('://')[1]
              this.fixVal = ''
            }
          }else{
            this.$message.error('跑马灯获取失败')
          }
        },
        error:()=>{
          this.$message.error('跑马灯获取失败')
        }
      })
    },
    //获取播放器限制
    getRestrict(){
      this.$postStream('/admin/instance/ccb/polyv/player/getRestrict.do',{
        data:{
          appId: this.devAppId
        },
        success: (res)=> {
          if(res.success){
            this.form.blackText = res.object.websiteBlacklist || ''
            this.form.whiteText = res.object.websiteWhitelist || ''
          }else{
            this.$message.error('获取播放网站限制失败!')
          }
        }
      })
    },
    getGuaidPic(pic){
      this.guaidPic = pic
    },
    save() {
      if(this.demandRadio=='code'){
        if(!this.identifyCode || !(this.identifyCode.trim())){
          this.$message.error('验证码不能为空')
          return
        }
        if(!this.welcomeTitle || !(this.welcomeTitle.trim())){
          this.$message.error('欢迎标题不能为空')
          return
        }
      }
      if(this.demandRadio=='external'){
        if(!this.selfDefiURL || !(this.selfDefiURL.trim())){
          this.$message.error('自定义URL不能为空')
          return
        }else if(!this.$utils.isUrl(this.selfDefiURL)){
          this.$message.error('自定义URL格式错误')
          return
        }
        if(!this.externalRedirectUri || !(this.externalRedirectUri.trim())){
          this.$message.error('跳转地址不能为空')
          return
        }else if(!this.$utils.isUrl(this.externalRedirectUri)){
          this.$message.error('跳转地址格式错误')
          return
        }
      }
      if(this.isLamp){
        if(this.lampType=='fixed'){
          if(!this.fixVal || !(this.fixVal.trim())){
            this.$message.error('固定值不能为空')
            return
          }
          if(!this.fontSize){
            this.$message.error('字体大小不能为空')
            return
          }
          if(!this.fontColor){
            this.$message.error('字体颜色不能为空')
            return
          }
        }
        if(this.lampType=='nickname'){
          if(!this.fontSize){
            this.$message.error('字体大小不能为空')
            return
          }
          if(!this.fontColor){
            this.$message.error('字体颜色不能为空')
            return
          }
        }
        if(this.lampType=='diyurl'){
          if(!this.qturl || !(this.qturl.trim())){
            this.$message.error('自定义URL不能为空')
            return
          }
        }
      }
      //黑白名单
      let whiteArea = []
      whiteArea=this.form.whiteText.split(',')
      if(whiteArea==""){
      }else{
        for(var i=0;i<whiteArea.length;i++){
          if(!this.$utils.isCom(whiteArea[i])){
            this.$message.error('白名单请填写正确的域名格式')
            return
          }
        }
      }
      let blackArea = []
      blackArea=this.form.blackText.split(',')
      if(blackArea==""){
      }else{
        for(var i=0;i<blackArea.length;i++){
          if(!this.$utils.isCom(blackArea[i])){
            this.$message.error('黑名单请填写正确域名格式')
            return
          }
        }
      }
      if(this.form.whiteText === this.form.blackText && this.form.whiteText != ''){
        this.$message.error('黑白名单不能完全相同')
        return
      }
      //设置观看条件
      let reqData = {
          appId:this.devAppId,
          rank: 1,
          enabled: this.demandRadio=='none'?'N':'Y',//是否开启观看条件(Y/N)
          authCode: this.identifyCode,//验证码
          qcodeTips: this.welcomeTitle,//欢迎语标题
          externalKey: this.SecretKey,//SecretKey
          externalRedirectUri: this.externalRedirectUri,//跳转地址
          externalUri: this.selfDefiURL,//自定义url
          validTimePeriod: 0,//付费有效时长，单位天
        }
      if(this.demandRadio!='none'){
        reqData.authType=this.demandRadio//观看条件类型(1. 无限制 none 2. 验证码观看 code 3. 外部授权观看 external
      }
      this.$postStream('/admin/instance/ccb/polyv/pageview/condition/updateViewCondition.do',{
        data:reqData, 
        success:(res)=>{
          if(res.success){
            //设置基础图片
            this.$postStream('/admin/instance/ccb/polyv/app/updateBaseImage.do',{
              data:{
                appId: this.devAppId,
                coverImg: this.guaidPic || '/assets/wimages/pc_images/logo.png'//频道引导图地址
              },
              success:(res)=>{
                if(res.success){
                  //设置跑马灯
                  this.$postStream('/admin/instance/ccb/polyv/player/updateHorseLamp.do',{
                    data:{
                      appId: this.devAppId,
                      marqueeType: this.lampType,//跑马灯类型
                      marquee: this.lampType=='fixed'?this.fixVal:(this.setUrl+this.qturl),//固定值或自定义url
                      marqueeFontColor: this.fontColor,//跑马灯文字字体颜色
                      marqueeFontSize: this.fontSize,
                      marqueeOpacity: this.slideVal,
                      marqueeRestrict: this.isLamp?'Y':'N',//自定义url防录屏跑马灯开关
                      marqueeAutoZoomEnabled:this.isScale?'Y':'N',//是否开启跑马灯自适应缩放
                    },
                    success:(res)=>{
                      if(res.success){
                        this.$postStream('/admin/instance/ccb/polyv/player/updateRestrictWeb.do',{
                          data:{
                            appId: this.devAppId,
                            websiteBlacklist: this.form.blackText || '',
                            websiteWhitelist: this.form.whiteText || ''
                          },
                          success: (res)=> {
                            if(res.success){
                              this.$message.success('保存成功!')
                            }else{
                              this.$message.error('设置网站限制失败!')
                            }
                          }
                        })
                      }else{
                        this.$message.error('设置跑马灯失败')
                        
                      }
                    },
                    error:()=>{
                      this.$message.error('设置跑马灯失败')
                    }
                  })
                }else{
                  this.$message.error('设置应用图片失败')
                }
              },
              error:()=>{
                this.$message.error('设置应用图片失败')
              }
            })
          }else{
            if(res.code == 50001){
              this.$message.error(res.message)
            }else{
              this.$message.error('设置观看条件失败')
            }
          }
        },
        error:()=>{
          this.$message.error('设置观看条件失败')
        }
      })
    
    },
    // 更换secretKey
    changeKey(){
      this.$postStream("/admin/instance/ccb/polyv/common/createSecretKey.do", {
        data:{},
        success: res => {
          if(res.success){
            this.SecretKey = res.object.secretKey
          }else{
            if(res.code == 50001){
              this.$message.error(res.message)
            }else{
              this.$message.error('操作失败')
            }
          }
        },
        error: () => {
          this.$message.error('操作失败')
        }
      });
    }
  },
  created(){
    this.devAppId = this.$route.query.devAppId
    if(!this.devAppId){
      this.devAppId = sessionStorage.getItem('curAccountAppId')
    }
    this.getDefSetData()
    this.sessionKey = JSON.parse(sessionStorage.getItem('UserInfo')).sessionKey
    this.sessionKeyBody = {
      'session-key':this.sessionKey
    }
    this.dataBody = {
      appId:this.devAppId
    }
  }
};
</script>
<style lang="scss">
.theform{
  width: 600px;
  .el-form-item__content{
    line-height: 20px;
    div{
      color:#999;
    }
  }
}
.lampUrl .el-input-group__prepend{
  width:90px;
}
.forbidInput{
  width:30%;
  height: 34px !important;
  input{
    height: 34px !important;
  }
  span i{
    display: flex;
    align-items: center;
  }
}
.rowInput{
  width:100% !important;
  input{
    height: 34px;
    margin:2px 0;
  }
}
.forbTable>div>div:nth-last-of-type(1){
  display:none;
}
.forbTable>div>div:nth-last-of-type(2){
  margin-bottom:0px !important;
}
.forbDia>div{
  margin-top:8vh;
}
.forbTable{
  margin-top:10px;
  max-height:54vh;
  overflow-y: auto;
}
</style>
<style lang="scss" scoped>
.forbAddBtn{
  float:right;
  margin-left:10px;
}
.forbTable{
  margin-top:10px;
}
.attachTitle{
  color:#999;
}
.forbidSet{
  position:absolute;
  bottom:0px;
  height:25px;
  padding-left:10px;
}
.switchBtn>div>div{
  position: absolute;
  top: 50%;
  transform: translateY(-65%);
}
.switchBtn button{
  position:absolute;
  left:50px;
}
.colorSet{
  color:#606266;
  position: absolute;
  top: 50%;
  transform: translateY(-65%);
}
p{
  padding-top:10px;
}
.changebtn {  
  margin-left: 10px;
  height: 40px;
}
.titles {
  display: inline-block;
  height: 40px;
  line-height: 40px;
  &::before {
    content: " ";
    width: 5px;
    height: 30px;
    background: #409eff;
    display: inline-block;
    vertical-align: top;
    margin: 5px 10px;
  }
}
.photoContain {
  display: inline-block;
  width: 100px;
  height: 100px;
  border:1px solid #ccc;
  border-radius: 5px;
  margin-top:10px;
  img {
    width: 100%;
    height: 100%;
    border-radius: 5px;
  }
}
</style>
